using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Photos
{
    /// <summary>
    /// <para>Match Photos To Rows By Time</para>
    /// <para>Matches photo files to table or feature class rows according to the photo and row time stamps. The row with the time stamp closest to the capture time of a photo will be matched to that photo. Creates a new table containing the ObjectIDs from the input rows and their matching photo paths. Optionally adds matching photo files to the rows of the input table as geodatabase attachments.</para>
    /// <para>根据照片和行时间戳将照片文件与表或要素类行进行匹配。时间戳最接近照片拍摄时间的行将与该照片匹配。创建一个新表，其中包含输入行中的 ObjectID 及其匹配的照片路径。（可选）将匹配的照片文件作为地理数据库附件添加到输入表的行中。</para>
    /// </summary>    
    [DisplayName("Match Photos To Rows By Time")]
    public class MatchPhotosToRowsByTime : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public MatchPhotosToRowsByTime()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_Folder">
        /// <para>Input Folder</para>
        /// <para>The folder where photo files are located. This folder is scanned recursively for photo files; any photos in the base level of the folder, as well as in any subfolders, will be added to the output.</para>
        /// <para>照片文件所在的文件夹。以递归方式扫描此文件夹以查找照片文件;文件夹基本级别以及任何子文件夹中的任何照片都将添加到输出中。</para>
        /// </param>
        /// <param name="_Input_Table">
        /// <para>Input Table</para>
        /// <para>The table or feature class whose rows will be matched with photo files. The input table will typically be a point feature class representing GPS recordings.</para>
        /// <para>其行将与照片文件匹配的表或要素类。输入表通常是表示 GPS 记录的点要素类。</para>
        /// </param>
        /// <param name="_Time_Field">
        /// <para>Time Field</para>
        /// <para>The date/time field from the input table that indicates when each row was captured or created. Must be a date field; cannot be a string or numeric field.</para>
        /// <para>输入表中的日期/时间字段，指示捕获或创建每行的时间。必须是日期字段;不能是字符串或数值字段。</para>
        /// </param>
        /// <param name="_Output_Table">
        /// <para>Output Table</para>
        /// <para>The output table containing the OBJECTIDs from the input table that match a photo, and the matching photo path. Only OBJECTIDs from the input table that are found to match a photo are included in the output table.</para>
        /// <para>输出表包含输入表中与照片匹配的 OBJECTID 以及匹配的照片路径。输出表中仅包含输入表中发现与照片匹配的 OBJECTID。</para>
        /// </param>
        public MatchPhotosToRowsByTime(object _Input_Folder, object _Input_Table, object _Time_Field, object _Output_Table)
        {
            this._Input_Folder = _Input_Folder;
            this._Input_Table = _Input_Table;
            this._Time_Field = _Time_Field;
            this._Output_Table = _Output_Table;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Match Photos To Rows By Time";

        public override string CallName => "management.MatchPhotosToRowsByTime";

        public override List<string> AcceptEnvironments => ["extent", "workspace"];

        public override object[] ParameterInfo => [_Input_Folder, _Input_Table, _Time_Field, _Output_Table, _Unmatched_Photos_Table, _Add_Photos_As_Attachments.GetGPValue(), _Time_Tolerance, _Clock_Offset];

        /// <summary>
        /// <para>Input Folder</para>
        /// <para>The folder where photo files are located. This folder is scanned recursively for photo files; any photos in the base level of the folder, as well as in any subfolders, will be added to the output.</para>
        /// <para>照片文件所在的文件夹。以递归方式扫描此文件夹以查找照片文件;文件夹基本级别以及任何子文件夹中的任何照片都将添加到输出中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Folder")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Folder { get; set; }


        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table or feature class whose rows will be matched with photo files. The input table will typically be a point feature class representing GPS recordings.</para>
        /// <para>其行将与照片文件匹配的表或要素类。输入表通常是表示 GPS 记录的点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Table { get; set; }


        /// <summary>
        /// <para>Time Field</para>
        /// <para>The date/time field from the input table that indicates when each row was captured or created. Must be a date field; cannot be a string or numeric field.</para>
        /// <para>输入表中的日期/时间字段，指示捕获或创建每行的时间。必须是日期字段;不能是字符串或数值字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Time_Field { get; set; }


        /// <summary>
        /// <para>Output Table</para>
        /// <para>The output table containing the OBJECTIDs from the input table that match a photo, and the matching photo path. Only OBJECTIDs from the input table that are found to match a photo are included in the output table.</para>
        /// <para>输出表包含输入表中与照片匹配的 OBJECTID 以及匹配的照片路径。输出表中仅包含输入表中发现与照片匹配的 OBJECTID。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Output_Table { get; set; }


        /// <summary>
        /// <para>Unmatched Photos Table</para>
        /// <para><xdoc>
        ///   <para>The optional output table that will list any photo files in the input folder with an invalid time stamp or any photos that cannot be matched because there is no input row within the time tolerance.</para>
        ///   <para>If no path is specified, this table will not be created.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>可选的输出表，将列出输入文件夹中具有无效时间戳的任何照片文件，或由于时间容差内没有输入行而无法匹配的任何照片。</para>
        ///   <para>如果未指定路径，则不会创建此表。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Unmatched Photos Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Unmatched_Photos_Table { get; set; } = null;


        /// <summary>
        /// <para>Add Photos As Attachments</para>
        /// <para><xdoc>
        ///   <para>Specifies if photo files will be added to the rows of the input table as geodatabase attachments. The input table must be stored in a version 10 or later geodatabase for photo files to be added as attachments.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Photo files will be added to the rows of the input table as geodatabase attachments. Geodatabase attachments are copied internally to the geodatabase. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Photo files will not be added to the rows of the input table as geodatabase attachments.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否将照片文件作为地理数据库附件添加到输入表的行中。输入表必须存储在版本 10 或更高版本的地理数据库中，才能将照片文件添加为附件。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 照片文件将作为地理数据库附件添加到输入表的行中。地理数据库附件将在内部复制到地理数据库。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 照片文件不会作为地理数据库附件添加到输入表的行中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Add Photos As Attachments")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Add_Photos_As_Attachments_value _Add_Photos_As_Attachments { get; set; } = _Add_Photos_As_Attachments_value._true;

        public enum _Add_Photos_As_Attachments_value
        {
            /// <summary>
            /// <para>ADD_ATTACHMENTS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ADD_ATTACHMENTS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_ATTACHMENTS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_ATTACHMENTS")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Time Tolerance</para>
        /// <para><xdoc>
        ///   <para>The maximum difference (in seconds) between the date/time of an input row and a photo file that will be matched. If an input row and a photo file have time stamps that are different by more than this tolerance, no match will occur. To match a photo file to a row with the closest time stamp, regardless of how large the date/time difference might be, set the tolerance to 0. The sign of this value (- or +) is irrelevant; the absolute value of the number specified will be used.</para>
        ///   <para>Do not use this parameter to adjust for consistent shifts or offsets between the times recorded by the GPS and the digital camera. Use the Clock Offset parameter, or the Convert Time Zone tool to shift the time stamps of the input rows to match those of the photos.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输入行的日期/时间与将要匹配的照片文件之间的最大差值（以秒为单位）。如果输入行和照片文件的时间戳相差超过此容差，则不会发生匹配。若要将照片文件与时间戳最接近的行匹配，无论日期/时间差异有多大，请将容差设置为 0。此值的符号（- 或 +）无关紧要;将使用指定数字的绝对值。</para>
        ///   <para>请勿使用此参数来调整 GPS 和数码相机记录的时间之间的一致偏移或偏移。使用时钟偏移参数或转换时区工具可以移动输入行的时间戳以匹配照片的时间戳。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _Time_Tolerance { get; set; } = 0;


        /// <summary>
        /// <para>Clock Offset</para>
        /// <para><xdoc>
        ///   <para>The difference (in seconds) between the internal clock of the digital camera used to capture the photos and the GPS unit. If the clock of the digital camera is behind the clock of the GPS unit, use a positive value; if the clock of the digital camera is ahead of the clock of the GPS unit, use a negative value.</para>
        ///   <para>For example, if a photo with a time stamp of 11:35:17 should match a row with a time stamp of 11:35:32, use a Clock Offset of 15.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于拍摄照片的数码相机的内部时钟与GPS单元之间的差异（以秒为单位）。如果数码相机的时钟落后于GPS单元的时钟，则使用正值;如果数码相机的时钟领先于 GPS 单元的时钟，请使用负值。</para>
        ///   <para>例如，如果时间戳为 11：35：17 的照片应与时间戳为 11：35：32 的行匹配，请使用时钟偏移量 15。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Clock Offset")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _Clock_Offset { get; set; } = 0;


        public MatchPhotosToRowsByTime SetEnv(object extent = null, object workspace = null)
        {
            base.SetEnv(extent: extent, workspace: workspace);
            return this;
        }

    }

}